package com.cmbyc.JDBC.sink

import com.cmbyc.JDBC.source.Student
import org.apache.flink.streaming.api.functions.sink.RichSinkFunction

import java.sql.{Connection, PreparedStatement}

/**
 *
 * @program: com.cmbyc.JDBC.sink
 * @author: YCLW058
 * @create: 2021-05-19 14:25
 * @decsription:
 *
 * */

class MySQLSink extends RichSinkFunction[Student]{
  // 定义连接 预编译语句
  var conn: Connection = _
  var ps: PreparedStatement = _

  override def close(): Unit = {
    if (conn != null) conn.close()
    if (ps != null) ps.close()
  }
}
